from typing import List, Dict, Any
from inspect import isclass


class PMBuiltinFunction:
    def __init__(self, name: str):
        self.name = name

    def __call__(self, builder, args: List = None, arg_types=None, name=''):
        raise NotImplementedError


def get_function_cls(globals_: Dict[str, Any]):
    """
    Pass globals() to this function, to get subclasses of `PMBuiltinFunction`.

    :param globals_:
    :return:
    """
    return [v for k, v in globals_.items() if (isclass(v) and
                                               issubclass(v, PMBuiltinFunction) and (v != PMBuiltinFunction))]
